package com.urms.service.impl;

import com.urms.mapper.RoleMenuMapper;
import com.urms.service.RoleMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleMenuServiceImpl implements RoleMenuService {

    @Autowired
    private RoleMenuMapper roleMenuMapper;

    @Override
    public Integer insertRoleMenu(Integer roleId, Integer[] menuIds) {
        roleMenuMapper.deleteAllByRoleId(roleId);
        return roleMenuMapper.insertRoleMenu(roleId,menuIds);
    }

    @Override
    public List<Integer> selectByRoleId(Integer roleId) {
        return roleMenuMapper.selectByRoleId(roleId);
    }

    @Override
    public List<String> selectMenuByUserLoginName(String user) {
        return roleMenuMapper.selectMenuByUserLoginName(user);
    }
}
